
package com.ojoin.trade.supplyloan_core.web.dao;

import java.util.List;
import java.util.Map;

import com.ojoin.trade.supplyloan_core.web.domain.TbPlatformExpireVo;
import org.springframework.data.domain.Pageable;

import com.ojoin.trade.common.exception.BusinessException;
import com.ojoin.trade.common.web.dao.BaseDao;
import com.ojoin.trade.supplyloan_core.web.domain.TbSlPlatformUser;
import com.ojoin.trade.supplyloan_core.web.domain.TbSlPlatformUserVO;
import com.ojoin.trade.supplyloan_core.web.domain.TbSlPlatformUserWithdrawVO;

/**
 * Created with IntelliJ IDEA.
 * User: Administrator
 * Date: 15-10-22
 * Time: 上午11:10
 * To change this template use File | Settings | File Templates.
 */
public interface TbSlPlatformUserDao extends BaseDao<TbSlPlatformUser> {
    
	 /**
     * 根据九盈用户id
     * 批量新增电商平台用户
     * @param list
     * @throws BusinessException
     */
    public  void insertBatchTbSlPlatformUser(List<TbSlPlatformUser> list)throws BusinessException;

    public int deleteByJoinId(int joinId) throws BusinessException;
    
    public List<TbSlPlatformUser> queryVagueByName(String platformName)throws BusinessException;
    
    public List<TbSlPlatformUser> queryTbSlPlatFormByPlatformType(String platformName)throws BusinessException;
    
    public  List<TbSlPlatformUser> queryTbSlPlatFormByJoinidandName(String platformName,int idOfTbMerchantUser)throws BusinessException;
    
    public void insertTbSlPlatformUser(TbSlPlatformUser uservo)throws BusinessException;
    
    public void updateTbSlPlatFormUser(Map<String,Object> map)throws BusinessException;
    
    /**
     * 查询某位用户的电商平台用户列表
     * @param idOfTbMerchantUser
     * @return
     * @throws BusinessException
     */
    public List<TbSlPlatformUserVO> selectAllPlatformUserListByJoinID(int idOfTbMerchantUser, Pageable page) throws BusinessException;
        
    /**
     * 查询join用户的所有需执行抓取任务的电商平台账号
     * @param idOfTbMerchantUser
     * @return
     * @throws BusinessException
     */
    public List<TbSlPlatformUser> selectPlatformUserListByJoinID(
			int idOfTbMerchantUser) throws BusinessException;
    
    public void deleteByJoinandId(int joinid,int id)throws BusinessException;
    
    /**
     * 更新电商平台用户的启用状态
     * @param id
     * @param status
     * @return
     * @throws BusinessException
     */
    public int updatePlatformUserEnableflagById(int id, String enableflag) throws BusinessException;

    /**
     * 更新电商平台用户的启用状态
     * @param id
     * @param joinuserid
     * @param status
     * @return
     * @throws BusinessException
     */
    public int updatePlatformUserEnableflagByPIdAndJId(int id, int joinuserid, String enableflag) throws BusinessException;

    
    /**
     * 更新九盈用户的所有电商平台用户的启用状态
     * @param id
     * @param status
     * @return
     * @throws BusinessException
     */
    public int updatePlatformUserEnableflagByJoinuserId(int joinuserid, String enableflag) throws BusinessException;

    /**
     * 查询指定九盈用户是否存在状态为申请暂停的电商平台用户
     * @param joinuserid
     * @return
     * @throws BusinessException
     */
    public int isExistPausedPlatformUserByJoinuserId(int joinuserid) throws BusinessException;

    /**
     * 根据九盈用户、电商平台名、启用状态查询电商平台用户列表
     * @param joinuserid
     * @param platform_name
     * @param enable_flag
     * @return
     */
    public List<TbSlPlatformUserVO> selectPlatformUserListByNameAndFlag(
			String joinuserid, String platform_name, String enable_flag)
			throws BusinessException;
    
    /**
     * 根据九盈用户查询其在各电商平台的可提限额详细列表
     * @param joinuserid
     * @return
     */
    public List<TbSlPlatformUserWithdrawVO> selectPlatformUserWithdrawListByJoinuserId(int joinuserid) throws BusinessException;

    /**
     * 给电商平台用户授信
     * 
     * @param id
     * @param joinuserid
     * @param operatorJoinuserid
     * @param discount
     * @param rate
     * @param fee
     * @param max_amount
     * @param credit_certificate
     * @param clientTs
     * @throws BusinessException
     */
    public int slPlatformUserCredit(TbSlPlatformUser uservo)
			throws BusinessException;
    
    public int slPlatformUserCredit(TbSlPlatformUserVO uservo)
			throws BusinessException;
    
    /**
	 * 根据九盈用户查询未授信的电商平台个数
	 * @param joinuserid
	 * @return
	 * @throws BusinessException
	 */
	public int selectUncreditPlatformUserByJoinuserId(int joinuserid) throws BusinessException;
	
    /**
     * 根据九盈用户、电商平台名、启用状态查询电商平台用户列表
     * @param joinuserid
     * @param platform_name
     * @param enable_flag
     * @return
     */
    public List<TbSlPlatformUserVO> selectPlatformUserListByNameAndFlag(
			String joinuserid, String platform_name, String enable_flag,Pageable page)
			throws BusinessException;
    
    /**
	 * 更新电商平台用户的密码
	 * @param joinuserid
	 * @param platformuserid
	 * @param newpwd
	 * @throws BusinessException
	 */
    public void updateTbSlPlatFormUserPwd(int joinuserid, int platformuserid,
			String newpwd) throws BusinessException;
    
    /**
     * 更新九盈用户的所有电商平台的征信信息
     * @param joinuserid
     * @param creditinfoid
     * @return
     * @throws BusinessException
     */
    public int updateMerchantUserCreditInfoByJoinuserId(int joinuserid,
			int creditinfoid) throws BusinessException;


   public List<TbPlatformExpireVo> queryTbPlatformExpire(int joinuserid)throws BusinessException;
}